package com.diana.mapper;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.diana.entity.Product;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author anzhi
 * @since 2019-12-05
 */
public interface ProductMapper extends BaseMapper<Product> {

    @Update("update product set num=num-1 where productId = #{productId} and num>0")
    int updateProductNum(@Param("productId")String productId);

}
